﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
    CodeBehind="Progs_Projects.aspx.cs" Inherits="Amkeni_System.CO.Progs_Projects" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% if (User.IsInRole("Administrator"))
       { %>
        <div style="height:2.5em;">
            <%--<div style="float:left;">
                <asp:Button ID="AddProjMetaDataButton" runat="server" Text="Add IP Metadata (Uploads)" OnClick="AddProjMetaDataButton_Click" />
            </div>--%>
            <div style="float:right;">
                <asp:Button ID="AddProjButton" runat="server" Text="Add Implementing Partner" OnClick="AddProjButton_Click" />
            </div>
        </div>
    <% } %>

    <asp:Label ID="Error" runat="server" Text="" Visible="false"></asp:Label>

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <asp:EntityDataSource ID="EntityDataSource3" runat="server" 
        ConnectionString="name=Amkeni_DatabaseEntities" DefaultContainerName="Amkeni_DatabaseEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="programme_outcome">
    </asp:EntityDataSource>

    <asp:Accordion ID="MyAccordion" runat="server" SelectedIndex="-1" AutoSize="None"
     FadeTransitions="true" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" 
     ContentCssClass="accordionContent" RequireOpenedPane="false" 
     SuppressHeaderPostbacks="true" OnItemDataBound="MyAccordion_ItemDataBound" DataSourceID="EntityDataSource3">
     
     <HeaderTemplate >
        <%# DataBinder.Eval(Container.DataItem, "outcome_id") %> <%# DataBinder.Eval(Container.DataItem, "thematic_area") %>
     </HeaderTemplate>
     <ContentTemplate>
         <asp:Label ID="proj_label" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "outcome_id") %>'></asp:Label>

         <% if (User.IsInRole("Administrator"))
            { %>
             <asp:GridView ID="ProjectGridView" runat="server" AutoGenerateColumns="False" CssClass="NewGrid" 
                DataKeyNames="ip_id, outcome_id" 
                OnRowEditing="ProjectGridView_RowEditing" OnRowUpdating="ProjectGridView_RowUpdating" 
                OnRowCancelingEdit="ProjectGridView_RowCancelingEdit" OnRowDeleting="ProjectGridView_RowDeleting">
             <AlternatingRowStyle CssClass="NewGridAlt" />
                 <Columns>
                     <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ShowHeader="False" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxProject" runat="server" Width="30em" Text='<%# Bind("name") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="ABBREVIATION" ShowHeader="false" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxAbbreviation" runat="server" Width="10em" Text='<%# Bind("abbreviation") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label2" runat="server" Text='<%# Bind("abbreviation") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>

                    <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />

                 </Columns>
             </asp:GridView>
         <% }
            else
            { %>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="NewGrid" 
            DataKeyNames="ip_id, outcome_id" 
            OnRowEditing="ProjectGridView_RowEditing" OnRowUpdating="ProjectGridView_RowUpdating" 
            OnRowCancelingEdit="ProjectGridView_RowCancelingEdit" OnRowDeleting="ProjectGridView_RowDeleting">
             <AlternatingRowStyle CssClass="NewGridAlt" />
                 <Columns>
                     <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ShowHeader="False" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxProject" runat="server" Width="30em" Text='<%# Bind("name") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="ABBREVIATION" ShowHeader="false" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxAbbreviation" runat="server" Width="10em" Text='<%# Bind("abbreviation") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label2" runat="server" Text='<%# Bind("abbreviation") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                 </Columns>
             </asp:GridView>
         <% } %>

     </ContentTemplate>
    </asp:Accordion>
    
</asp:Content>
